#ifndef __COMMMON_H_
#define __COMMMON_H_


#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <boost/foreach.hpp>

#define foreach BOOST_FOREACH 
#define reverse_foreach BOOST_REVERSE_FOREACH 


#include "matrix.h"
#include "matrix_util.h"
#include "primitive.h"
#include "mesh.h"
#include "aabbtree.h"



extern struct timeval tmstart, tmend;    
extern struct timeval genstart, genend;  
extern struct timezone tzp; 

#define LATENCY(OPERATION,NOTE)					\
	gettimeofday(&genstart, &tzp);				\
	OPERATION ;									\
    gettimeofday(&genend, &tzp);				\
    printElapsed(NOTE, &genstart, &genend, 1);	



typedef double Value; 
#define GLFLOAT(VAL) VAL


/*
#ifndef CORE_LEVEL
#   define CORE_LEVEL 3
#endif

#define CORE_NO_AUTOMATIC_NAMESPACE
#define GLFLOAT(VAL) \
	VAL.doubleValue()

#include "CORE/CORE.h" 

typedef CORE::Expr Value ;
*/


#include "booleanmesh.h"

typedef typename BooleanMeshPrimitive<Value>::PointType     PointType  ;
typedef typename BooleanMeshPrimitive<Value>::VectorType    VectorType ;
typedef typename BooleanMeshPrimitive<Value>::FaceType      FaceType   ;
typedef typename BooleanMeshPrimitive<Value>::VertexType    VertexType ;
typedef typename BooleanMeshPrimitive<Value>::HalfEdgeType      HalfEdgeType ; 
typedef typename BooleanMeshPrimitive<Value>::EdgeType      EdgeType ; 
typedef BooleanMesh <BooleanMeshPrimitive<Value> >                 MeshType ;

typedef AABBTreePoly <Value>                         AABBTreePolyType; 
typedef AABBTreePolyBuilder <Value>                  AABBTreePolyBuilderType  ; 
typedef AABBTreePolygon <Value>                      AABBTreePolygonType ;
typedef AABBTreeNode <Value> AABBTreeNodeType ;
typedef Box<Value> BoxType; 
typedef Segment<Value> SegmentType;
typedef Polygon<Value> PolygonType; 


#endif
